function sql () {
  const mysql = require('mysql2')
  const config = getConfig()
  const promisePool = mysql.createPool(config).promise()
  return promisePool
}

function getConfig () {
  return {
    host: '127.0.0.1',
    port: 3306,
    user: 'root',
    password: 'zlf20020429abcd',
    database: 'blog'
  }
}

module.exports = { sql }
